package com.mypackage.diary.modle;

// Generated Oct 28, 2014 3:47:35 PM by Hibernate Tools 4.0.0

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * FriendRequest generated by hbm2java
 */
@Entity
@Table(name = "FriendRequest")
public class FriendRequest implements java.io.Serializable {

	private FriendRequestId id;
	private UserProfile userProfileBySenderId;
	private UserProfile userProfileByReceiverId;
	private Date created;

	public FriendRequest() {
	}

	public FriendRequest(FriendRequestId id, UserProfile userProfileBySenderId,
			UserProfile userProfileByReceiverId) {
		this.id = id;
		this.userProfileBySenderId = userProfileBySenderId;
		this.userProfileByReceiverId = userProfileByReceiverId;
	}

	public FriendRequest(FriendRequestId id, UserProfile userProfileBySenderId,
			UserProfile userProfileByReceiverId, Date created) {
		this.id = id;
		this.userProfileBySenderId = userProfileBySenderId;
		this.userProfileByReceiverId = userProfileByReceiverId;
		this.created = created;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "senderId", column = @Column(name = "SenderId", nullable = false)),
			@AttributeOverride(name = "receiverId", column = @Column(name = "ReceiverId", nullable = false)) })
	public FriendRequestId getId() {
		return this.id;
	}

	public void setId(FriendRequestId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SenderId", nullable = false, insertable = false, updatable = false)
	public UserProfile getUserProfileBySenderId() {
		return this.userProfileBySenderId;
	}

	public void setUserProfileBySenderId(UserProfile userProfileBySenderId) {
		this.userProfileBySenderId = userProfileBySenderId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ReceiverId", nullable = false, insertable = false, updatable = false)
	public UserProfile getUserProfileByReceiverId() {
		return this.userProfileByReceiverId;
	}

	public void setUserProfileByReceiverId(UserProfile userProfileByReceiverId) {
		this.userProfileByReceiverId = userProfileByReceiverId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Created", length = 23)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

}
